<?php
require_once 'Zend/Db/Table/Abstract.php';

class Default_Model_DbTable_DictSettingsTable extends Zend_Db_Table_Abstract {
	/**
	 * The default table name
	 */
	protected $_name = 'dict_dict_settings';


	public function getEnabledDicts($user_id, $availabled_dicts) {
		if (count($availabled_dicts) == 0) return array();			
		$enabled_dicts =  $this->getAdapter()->fetchOne("select enabled_dicts from dict_dict_settings where user_id", $user_id);
		$user_dicts = explode("," ,str_replace(", ", ",",  $enabled_dicts));
		return  array_values(array_intersect($user_dicts, $availabled_dicts));
	}
}